package com.qing.serviceoss.controller;

import com.qing.servicebase.utils.ResponseResult;
import com.qing.serviceoss.service.FileService;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

/**
 * @ClassName Yjx
 * @Description TODO
 * @date 2022/9/8 11:11
 * @Version 1.0
 */
@RestController
@RequestMapping("/eduoss/file")
@CrossOrigin
public class FileUploadController {

    private final FileService fileService;

    public FileUploadController(FileService fileService) {
        this.fileService = fileService;
    }

    /**
     * 文件上传
     *
     * @param file
     */
    @PostMapping("/upload")
    public ResponseResult upload(@RequestParam("file") MultipartFile file) {
        //返回r对象
        return fileService.upload(file);
    }
//    https://edu-serviceq.oss-cn-hangzhou.aliyuncs.com/cover/default.jpg
}
